<template>
  <div class="fazx">
    <!-- 标题 -->
    <div class="tit">
      <h2>{{ tit.mainTit }}</h2>
      <p>{{ tit.subHead }}</p>
    </div>
    <!-- 内容 -->
    <div class="fazx-box">
      <!-- 头部 -->
      <div class="tit-box">
        <img src="../../assets/img/common/project.png" alt="方案">
        <p>方案 / Project</p>
      </div>
      <!-- 内容盒子 -->
      <div class="box">
        <!-- 第一行盒子开始 -->
        <div class="top-box">
          <div
            class="top-item-box"
            v-for="(item, index) in topBox"
            :key="item.index"
            :class="{borderCss: item.name == 'gazd'}"
          >
            <!-- normal开始 -->
            <div
              class="normal-box"
              v-if="item.type"
              @mouseover="topOver(index)"
            >
              <!-- img -->
              <div class="img-box">
                <img :src="item.img[0].imgNormal" alt="">
              </div>
              <!-- text -->
              <div class="text-box">
                <h2>{{ item.text.mainTit }}</h2>
                <p>{{ item.text.subHead }}</p>
              </div>
            </div>
            <!-- normal结束 -->

            <!-- hover开始 -->
            <div
              class="hover-box"
              v-else
              @mouseleave="topLeave(index)"
            >
              <!-- text -->
              <div class="text-box">
                <h2 class="main-tit">{{ item.text.mainTit }}</h2>
                <p class="solution">{{ item.text.solution }}</p>
                <p class="sub-head">{{ item.text.subHead }}</p>
                <p class="problem">{{ item.text.problem }}</p>
              </div>
              <!-- img -->
              <div class="img-box">
                <img :src="item.img[1].imgHover" alt="">
                <div class="ljgd" @click="btnClick(item)">了解更多</div>
              </div>
            </div>
            <!-- hover结束 -->
          </div>
        </div>
        <!-- 第一行盒子结束 -->

        <!-- 第二行盒子开始 -->
        <div class="bottom-box">
          <div
            class="bottom-item-box"
            v-for="(item, index) in bottomBox"
            :key="item.index"
          >
            <!-- normal开始 -->
            <div
              class="normal-box"
              :class="[
                {borderCss: item.name == 'jdzd'},
                {borderCss: item.name == 'qyzd'},
                {borderCss: item.name == 'zhyq'},
                {borderNone: item.name == 'szxc'},
              ]"
              v-if="item.type"
              @mouseover="bottomOver(index)"
            >
              <!-- img -->
              <div class="img-box">
                <img :src="item.img[0].imgNormal" alt="">
              </div>
              <!-- text -->
              <div class="text-box">
                <h2>{{ item.text.mainTit }}</h2>
              </div>
            </div>
            <!-- normal结束 -->
            <!-- hover开始 -->
            <div
              class="hover-box"
              v-else
              @mouseleave="bottomLeave(index)"
            >
              <!-- text -->
              <div class="text-box">
                <h2>{{ item.text.mainTit }}</h2>
                <p>{{ item.text.userPeo }}</p>
              </div>
              <!-- img -->
              <div class="img-box">
                <img :src="item.img[1].imgHover" alt="">
                <div class="ljgd" @click="btnClick(item)">了解更多</div>
              </div>
            </div>
            <!-- hover结束 -->
          </div>
        </div>
        <!-- 第二行盒子结束 -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Fazx",
  data() {
    return {
      tit: {
        mainTit: "一诺云方案中心",
        subHead: "业内领先的政企信息化解决方案服务商"
      },
      topBox: [
        {
          name: "gazd",
          goto: "/fazx/gazd",
          value: "gazd",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/gazd-normal.png")},
            {imgHover: require("assets/img/home/fazx/gazd-hover.png")}
          ],
          text: {
            mainTit: "公安主导型安防社区平台建设方案",
            subHead: "围绕建设平安中国、法治中国的总目标，坚持管理创新和技术创新，积极探索共建共治共享社会治理格局...",
            solution: "建设方案",
            problem: "提高社会治安防控能力和水平，预防、减少各类违法犯罪和治安灾害事故"
          }
        },
        {
          name: "zjzd",
          goto: "/fazx/zjzd",
          value: "zjzd",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/zjzd-normal.png")},
            {imgHover: require("assets/img/home/fazx/zjzd-hover.png")}
          ],
          text: {
            mainTit: "住建主导型城市级智慧物业建设方案",
            subHead: "住建主导型智慧物业政务平台建设方案主要适用于省、市、区/县住建（房管）物业行政主管部门，同时融合街道办事处、社区居委会、物业服务企业、业主委员会、广大居民等",
            solution: "解决方案",
            problem: "形成物业服务等级评价体系、促进物业服务行业资源整合、物业投诉联动受理"
          }
        }
      ],
      bottomBox: [
        {
          name: 'jdzd',
          goto: "/fazx/jdzd",
          value: "jdzd",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/jdzd-normal.png")},
            {imgHover: require("assets/img/home/fazx/jdzd-hover.png")}
          ],
          text: {
            mainTit: "街道主导型智慧社区平台建设方案",
            userPeo: "适用对象：行政主管部门、街道办事处"
          }
        },
        {
          name: 'qyzd',
          goto: "/fazx/qyzd",
          value: "qyzd",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/qyzd-normal.png")},
            {imgHover: require("assets/img/home/fazx/qyzd-hover.png")}
          ],
          text: {
            mainTit: "企业主导型智慧物业平台建设方案",
            userPeo: "适用对象：物业行政主管部门"
          }
        },
        {
          name: 'zhyq',
          goto: "/fazx/zhyq",
          value: "zhyq",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/zhyq-normal.png")},
            {imgHover: require("assets/img/home/fazx/zhyq-hover.png")}
          ],
          text: {
            mainTit: "智慧园区平台建设方案",
            userPeo: "适用对象：物业服务企业"
          }
        },
        {
          name: 'szxc',
          goto: "/fazx/szxc",
          value: "szxc",
          type: true,
          img: [
            {imgNormal: require("assets/img/home/fazx/szxc-normal.png")},
            {imgHover: require("assets/img/home/fazx/szxc-hover.png")}
          ],
          text: {
            mainTit: "数字乡村平台建设方案",
            userPeo: "适用对象：工业园区、自贸园区"
          }
        }
      ]
    }
  },
  methods: {
    // 头部移入移出
    topOver(index) {
      this.topBox[index].type = false;
    },
    topLeave(index) {
      this.topBox[index].type = true;
    },
    // 底部移入移出
    bottomOver(index) {
      this.bottomBox[index].type = false;
    },
    bottomLeave(index) {
      this.bottomBox[index].type = true;
    },
    // 点击跳转路由
    btnClick(item) {
      this.$router.push({
        path: item.goto,
        query: {
          link: "fazx",
          name: item.value,
        }
      })
    }
  }
}
</script>

<style>
  .fazx {
    width: 62.5%;
    margin: 40px auto;
    text-align: center;
  }

  /* 标题 */
  .fazx .tit {
    margin-bottom: 24px;
  }

  .fazx .tit h2 {
    font-size: 36px;
    font-weight: 1000;
    color: #333;
  }

  .fazx .tit p {
    font-size: 16px;
    color: #666;
  }

  /* 头部 */
  .fazx-box .tit-box {
    height: 64px;
    background-image: url("../../assets/img/common/blue-bg.png");
    display: flex;
    align-items: center;
  }

  .fazx-box .tit-box img {
    margin-left: 24px;
    margin-right: 8px;
  }

  .fazx-box .tit-box p {
    color: #fff;
    font-size: 20px;
  }

  /* 第一行样式开始 */
  .fazx-box .top-box {
    display: flex;
    height: 292px;
    border-bottom: 2px solid #f7f7f7;
  }

  .fazx-box .top-box .top-item-box {
    flex: 1;
  }

  /* top-item-box .normal-box */
  .fazx-box .top-box .top-item-box .normal-box {
    padding: 24px 0;
  }
  
  .fazx-box .top-box .top-item-box .normal-box img {
    margin-bottom: 16px;
  }

  .fazx-box .top-box .top-item-box .normal-box h2 {
    font-size: 28px;
    font-weight: 1000;
    color: #333;
    margin-bottom: 24px;
  }

  .fazx-box .top-box .top-item-box .normal-box p {
    font-size: 16px;
    color: #666;
    padding: 0 24px;
  }

  /* top-item-box .hover-box */
  .fazx-box .top-box .top-item-box .hover-box {
    display: flex;
    height: 100%;
    padding: 24px;
    background: linear-gradient(to right, #1890ff, #69c0ff);
    color: #fff;
    text-align: left;
  }

  .fazx .top-item-box .hover-box h2 {
    font-size: 24px;
    font-weight: 1000;
    color: #fff;
    margin-bottom: 8px;
  }

  .fazx .top-item-box .hover-box .solution {
    margin-bottom: 24px;
  }

  .fazx .top-item-box .hover-box .sub-head {
    padding-right: 16px;
  }

  .fazx .top-item-box .hover-box .problem {
    margin-top: 16px;
    padding-right: 16px;
  }

  .fazx .top-item-box .hover-box .img-box {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
  }
  /* 第一行样式结束 */

  /* 第二个normal样式开始 */
  .bottom-box {
    display: flex;
    flex-wrap: wrap;
  }

  .bottom-item-box {
    width: 25%;
    border-bottom: 2px solid #f7f7f7;
  }

  .bottom-item-box .normal-box {
    height: 160px;
    padding: 36px 0;
    /* background-color: #bfa; */
  }

  .bottom-item-box .normal-box img {
    margin-bottom: 16px;
  }

  .bottom-item-box .normal-box h2 {
    font-size: 18px;
    font-weight: 1000;
    color: #333;
  }
  /* 第二个normal样式结束 */

  /* 第二个hover样式开始 */
  .bottom-item-box .hover-box {
    text-align: left;
    height: 160px;
    padding: 24px;
    background: linear-gradient(to right, #1890ff, #69c0ff);
    display: flex;
  }

  .bottom-item-box .hover-box .text-box h2 {
    font-size: 20px;
    font-weight: 1000;
    color: #fff;
    margin-bottom: 24px;
  }

  .bottom-item-box .hover-box .text-box p {
    font-size: 14px;
    color: #fff;
    padding-right: 24px;
  }

  .bottom-item-box .hover-box .img-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }
  /* 第二个hover样式结束 */

  /* 了解更多 */
  .ljgd {
    width: 88px;
    height: 32px;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50px;
    text-align: center;
    line-height: 28px;
  }

  .ljgd:hover {
    background-color: #fff;
    color: #333;
    cursor: pointer;
  }
  

  /* 边框统一样式 */
  .borderCss {
    border-right: 2px solid #f7f7f7;
  }

  /* hover-box */
  .fazx .top-item-box .hover-box,
  .fazx .bottom-item-box .hover-box {
    transition-duration: 0.3s;
    transform: scale(1.02);
    box-shadow: 0 0 1rem #1890ff;
  }
</style>